package org.ifdb;

import javax.jdo.PersistenceManagerFactory;

import org.ifdb.persistency.PMF;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.google.appengine.api.users.UserService;
import com.google.appengine.api.users.UserServiceFactory;

@Configuration
public class AppConfig {
    
    /**
     * Google's UserService is part of a jar, so we cannot use
     * Spring's "component scanning".  Thus, we explicitly
     * declare it as a bean for DI.
     */
    @Bean
    public UserService userService() {
        return UserServiceFactory.getUserService();
    }
    
    @Bean
    public PersistenceManagerFactory persistenceManagerFactory() {
        return PMF.get();
    }
    
}